package Lee_code;

public class Lee_27 {
    public int removeElement(int[] nums, int val) {

        int fast = 0, slow = 0;
        //fast去找非val, slow去找val
        while(fast< nums.length)
        {
            if(nums[fast]==val)
            {
                fast++;
            }
            if(nums[slow]!=val)
            {
                slow++;
            }
            if(nums[fast]!=val&&nums[slow]==val)
            {
                nums[slow]=nums[fast];
                slow = fast+1;
                fast++;
            }
        }
        return slow;
    }
}
